package com.neusoft.modules.web.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neusoft.modules.web.dao.FileUploadDao;
import com.neusoft.modules.web.entity.FileInfoEntity;
import com.neusoft.modules.web.service.FileUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Slf4j
@Service("fileUploadService")
@CacheConfig(cacheNames = "fileupload")
public class FileUploadServiceImpl extends ServiceImpl<FileUploadDao, FileInfoEntity> implements FileUploadService {

    @Resource
    private FileUploadDao fileUploadDao;

    @Override
    public FileInfoEntity queryFileInfoByIdentifier(String identifier, String fileName) {
        FileInfoEntity fileInfo = fileUploadDao.queryFileInfoByIdentifier(identifier, fileName);
        return fileInfo;
    }

    @Override
    @Transactional
    public boolean saveFileInfo(FileInfoEntity fileInfo) {
        return this.save(fileInfo);
    }
}
